package com.cap.bts.crmdp.dealer.purchase.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.cap.bts.crmdp.dealer.card.domain.CardDefinition;
import com.cap.bts.crmdp.dealer.card.domain.CardGeneration;
import com.cap.bts.framework.common.domain.BaseDomain;


/**
 * The persistent class for the tm_member_package_info database table.
 * 
 */
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Entity
@Table(name="TM_MEMBER_PACKAGE_INFO")
@AttributeOverrides({
    @AttributeOverride(name="createBy", column=@Column(name="CREATE_BY")),
    @AttributeOverride(name="createDate", column=@Column(name="CREATE_DATE", nullable = false)),
    @AttributeOverride(name="lastUpdateBy", column=@Column(name="LAST_UPDATE_BY")),
    @AttributeOverride(name="lastUpdateDate", column=@Column(name="LAST_UPDATE_DATE"))
})
public class MemberPackageInfo extends BaseDomain implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 1891775838884073229L;

    private Long id;

    private String activationCode;

    private Date activeDate;

    private Double actualPrice;

    private Long carId;

    private Long dealerId;

    private Date expireDate;

    private Long memberId;

    private PackageDefinition packageDefinition;

    private String packageNumber;

    private Date purchaseDate;

    private byte status;
    
    private Long activeDealerId;
    
    private Long activeMemberId;
    
    private Long activeCarId;
    
    private CardDefinition cardDefinition;
    
    private CardGeneration cardGeneration;
    
    private Integer isGift;
    
    private Integer marsLockStatus;
    
    private String soNumberSale;
    
    private String soNumberActive;
    
    private String soNumberSettle;
    
    private String soNumberCancel;
    
    public MemberPackageInfo() {
    }

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name="ACTIVATION_CODE")
    public String getActivationCode() {
        return this.activationCode;
    }

    public void setActivationCode(String activationCode) {
        this.activationCode = activationCode;
    }

    @Temporal(TemporalType.DATE)
    @Column(name="ACTIVE_DATE")
    public Date getActiveDate() {
        if(activeDate!=null){
            return new Date(activeDate.getTime());
        }else{
            return null;
        }
    }

    public void setActiveDate(Date activeDate) {
        if(activeDate!=null){
            this.activeDate =new Date(activeDate.getTime());
        }else{
            this.activeDate=null;
        }
    }

    @Column(name="ACTUAL_PRICE")
    public Double getActualPrice() {
        return this.actualPrice;
    }

    public void setActualPrice(Double actualPrice) {
        this.actualPrice = actualPrice;
    }

    @Column(name="CAR_ID")
    public Long getCarId() {
        return this.carId;
    }

    public void setCarId(Long carId) {
        this.carId = carId;
    }

    @Column(name="DEALER_ID")
    public Long getDealerId() {
        return this.dealerId;
    }

    public void setDealerId(Long dealerId) {
        this.dealerId = dealerId;
    }

    @Temporal(TemporalType.DATE)
    @Column(name="EXPIRE_DATE")
    public Date getExpireDate() {
        if(expireDate!=null){
            return new Date(expireDate.getTime());
        }else{
            return null;
        }
    }
    
    public void setExpireDate(Date expireDate) {
        if(expireDate!=null){
            this.expireDate =  new Date(expireDate.getTime());
        }else{
            this.expireDate =null;
        }
    }

    @Column(name="MEMBER_ID")
    public Long getMemberId() {
        return this.memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    @ManyToOne(optional = true, targetEntity = PackageDefinition.class)
    @JoinColumn(name = "PACKAGE_DEF_ID", referencedColumnName = "ID")
    public PackageDefinition getPackageDefinition() {
        return this.packageDefinition;
    }
    
    public void setPackageDefinition(PackageDefinition packageDefinition) {
        this.packageDefinition = packageDefinition;
    }

    @Column(name="PACKAGE_NUMBER")
    public String getPackageNumber() {
        return this.packageNumber;
    }

    public void setPackageNumber(String packageNumber) {
        this.packageNumber = packageNumber;
    }

    @Temporal(TemporalType.DATE)
    @Column(name="PURCHASE_DATE")
    public Date getPurchaseDate() {
        if(purchaseDate!=null){
            return new Date(purchaseDate.getTime());
        }else{
            return null;
        }
    }

    public void setPurchaseDate(Date purchaseDate) {
        if(purchaseDate!=null){
            this.purchaseDate = new Date(purchaseDate.getTime());
        }else{
            this.purchaseDate =null;
        }
    }

    public byte getStatus() {
        return this.status;
    }

    public void setStatus(byte status) {
        this.status = status;
    }

    /**
     * @Date        :      Jul 31, 2015
     *
     * @return the activeDealerId
     */
    @Column(name="ACTIVE_DEALER_ID")
    public Long getActiveDealerId() {
        return activeDealerId;
    }

    /**
     * @Date        :      Jul 31, 2015
     *
     * @param activeDealerId the activeDealerId to set
     */
    public void setActiveDealerId(Long activeDealerId) {
        this.activeDealerId = activeDealerId;
    }

    /**
     * @Date        :      Jul 31, 2015
     *
     * @return the activeMemberId
     */
    @Column(name="ACTIVE_MEMBER_ID")
    public Long getActiveMemberId() {
        return activeMemberId;
    }

    /**
     * @Date        :      Jul 31, 2015
     *
     * @param activeMemberId the activeMemberId to set
     */
    public void setActiveMemberId(Long activeMemberId) {
        this.activeMemberId = activeMemberId;
    }

    /**
     * @Date        :      Jul 31, 2015
     *
     * @return the activeCarId
     */
    @Column(name="ACTIVE_CAR_ID")
    public Long getActiveCarId() {
        return activeCarId;
    }

    /**
     * @Date        :      Jul 31, 2015
     *
     * @param activeCarId the activeCarId to set
     */
    public void setActiveCarId(Long activeCarId) {
        this.activeCarId = activeCarId;
    }

    /**
     * @Date        :      Aug 24, 2015
     *
     * @return the cardDefinition
     */
    @ManyToOne(optional = true, targetEntity = CardDefinition.class)
    @NotFound(action=NotFoundAction.IGNORE)
    @JoinColumn(name = "CARD_DEF_ID", referencedColumnName = "ID")
    public CardDefinition getCardDefinition() {
        return cardDefinition;
    }

    /**
     * @Date        :      Aug 24, 2015
     *
     * @param cardDefinition the cardDefinition to set
     */
    public void setCardDefinition(CardDefinition cardDefinition) {
        this.cardDefinition = cardDefinition;
    }

    /**
     * @Date        :      Sep 1, 2015
     *
     * @return the cardGeneration
     */
    @ManyToOne(optional = true, targetEntity = CardGeneration.class)
    @JoinColumn(name = "GENERATION_BATCH_ID", referencedColumnName = "ID")
    @NotFound(action=NotFoundAction.IGNORE)
    public CardGeneration getCardGeneration() {
        return cardGeneration;
    }

    /**
     * @Date        :      Sep 1, 2015
     *
     * @param cardGeneration the cardGeneration to set
     */
    public void setCardGeneration(CardGeneration cardGeneration) {
        this.cardGeneration = cardGeneration;
    }

    @Column(name="IS_GIFT")
    public Integer getIsGift() {
        return isGift;
    }

    public void setIsGift(Integer isGift) {
        this.isGift = isGift;
    }

    @Column(name="MARS_LOCK_STATUS")
    public Integer getMarsLockStatus() {
        return marsLockStatus;
    }

    public void setMarsLockStatus(Integer marsLockStatus) {
        this.marsLockStatus = marsLockStatus;
    }

    @Column(name="SO_NUMBER_SALE")
    public String getSoNumberSale() {
        return soNumberSale;
    }

    public void setSoNumberSale(String soNumberSale) {
        this.soNumberSale = soNumberSale;
    }

    @Column(name="SO_NUMBER_ACTIVE")
    public String getSoNumberActive() {
        return soNumberActive;
    }

    public void setSoNumberActive(String soNumberActive) {
        this.soNumberActive = soNumberActive;
    }

    @Column(name="SO_NUMBER_SETTLE")
    public String getSoNumberSettle() {
        return soNumberSettle;
    }

    public void setSoNumberSettle(String soNumberSettle) {
        this.soNumberSettle = soNumberSettle;
    }

    @Column(name="SO_NUMBER_CANCEL")
    public String getSoNumberCancel() {
        return soNumberCancel;
    }

    public void setSoNumberCancel(String soNumberCancel) {
        this.soNumberCancel = soNumberCancel;
    }
    
}